package com.design;

/**
 * 简化的简单工厂模式
 * @author zhuangqi
 * @@date 2017/4/14.
 */
public class SimpleFactory2 {

    static abstract class Product{

        public static Product factoryMethod(String arg){
            Product product = null;
            if ("1".equals(arg)){
                product = new Product1();
            }
            return product;
        }

        abstract void display();


    }

    static class Product1 extends Product{

        @Override
        void display() {
            System.out.println("product1");
        }
    }

    public static void main(String[] args) {
        Product p = Product.factoryMethod("1");
        p.display();
    }


}
